package com.example.demo.common;


import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;


@ControllerAdvice
@ResponseBody
public class ExceptionAdvice {


    @ExceptionHandler(Exception.class)//一旦某一方法有异常就直接进这里了
    public Object expectionAdvice(Exception e) {
        return AjaxResult.fail(-1, e.getMessage());
    }

}
